import request from '@/utils/request'
// 申请材料 API接口
const api = {
  queryListByApplyid: '/apl_matter_attach/queryListByApplyid',
  saveReview: '/apl_matter_attach/saveReview',
  downloadMaterialAll: '/apl_matter_attach/downloadMaterialAll',
  queryAllList: '/apl_matter_attach/queryAllList',
  saveAllReview: '/apl_matter_attach/saveAllReview',
  queryThirdPersonMaterial: '/apl_matter_attach/queryThirdPersonMaterial',
  save: '/apl_matter_attach/save'
}

/**
 * 查询第三人的材料
 * @param {*} parameter
 * @returns
 */
 export function queryThirdPersonMaterial (applyid) {
  return request({
    url: api.queryThirdPersonMaterial,
    method: 'post',
    params: { applyid }
  })
}

/**
 * 获取其他材料列表
 * @param {*} parameter
 * @returns
 */
export function queryMatterAttachList (parameter) {
  return request({
    url: api.queryListByApplyid,
    method: 'get',
    params: parameter
  })
}

/**
 * 保存材料审查
 * @param {*} body
 * @returns
 */
export function saveMatterAttachReview (body) {
  return request({
    url: api.saveReview,
    method: 'post',
    data: body
  })
}

/**
 * 下载所有材料
 * @param {*} parameter
 * @returns
 */
export function downloadMaterialAll (parameter) {
  return request({
    url: api.downloadMaterialAll,
    method: 'post',
    params: parameter,
    responseType: 'blob'
  })
}

/**
 * 查询全部材料列表
 * @param {*} parameter
 * @returns
 */
export function queryAllMaterialList (parameter) {
  return request({
    url: api.queryAllList,
    method: 'get',
    params: parameter
  })
}

/**
 * 保存审查材料（针对全部材料）
 * @param {*} data
 * @returns
 */
export function saveReviewForAll (body) {
  return request({
    url: api.saveAllReview,
    method: 'post',
    data: body
  })
}

/**
 * 保存申请材料
 * @param {*} body
 */
export function saveApl_matter_attach (body) {
  return request({
    url: api.save,
    method: 'post',
    data: body
  })
}
